// 该文件用于创建整个应用的路由器
import VueRouter from "vue-router";
// 引入组件
import AboutVue from "../pages/AboutVue.vue";
import HomeVue from "../pages/HomeVue.vue";
import NewsVue from "../pages/NewsVue.vue";
import MessageVue from "../pages/MessageVue.vue";
import DetailVue from "../pages/DetailVue.vue";

// 创建并暴露一个路由器
export default new VueRouter({
  routes: [
    // 一级路由
    {
      path: "/about",
      component: AboutVue,
    },
    {
      path: "/home",
      component: HomeVue,
      children: [
        {
          path: "news",
          component: NewsVue,
        },
        {
          path: "message",
          component: MessageVue,
          children: [
            {
              path: "detail/:id/:title",
              component: DetailVue,
            },
          ],
        },
      ],
    },
  ],
});
